package com.iisi.core;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iisi.api.JoinService;
import com.iisi.dao.LessionDAO;
import com.iisi.domain.JoinDTO;
import com.iisi.domain.LessionDTO;
import com.iisi.entity.LessionPo;

@Service("joinService")
public class JoinServiceImpl implements JoinService {

	private static final Logger LOG = LoggerFactory
			.getLogger(JoinServiceImpl.class);

	@Autowired
	private transient LessionDAO lessionDao;

	public JoinServiceImpl() {
		LOG.info("JoinServiceImpl");
	}

	@Override
	public void apply(JoinDTO dto) {
		LOG.info("apply");

	}

	@Override
	public void doQuery(JoinDTO dto) {
		LOG.info("doQuery");

		dto.getLessions().clear();

		List<LessionDTO> lessions = new ArrayList<LessionDTO>();
		for (LessionPo po : lessionDao.getAll()) {
			final LessionDTO lessionDTO = new LessionDTO();
			lessionDTO.setPo(po);
			lessionDTO.setClicked(false);
		}

		dto.getLessions().addAll(lessions);

	}

	public LessionDAO getLessionDao() {
		return lessionDao;
	}

	public void setLessionDao(LessionDAO lessionDao) {
		this.lessionDao = lessionDao;
	}
	
	
}
